<%include header.ejs%>

<div class="container">
	<div class="row">
		<div class="col-xs-12">
			<h1><%=title%></h1>
			<p>Welcome to <%=title%></p>
			<p>
				<a class="btn btn-default" href="/reg">注册</a>
				<%if(!userInfo){%>
				<a class="btn btn-default" href="/login">登录</a>
				<%}else{%>
				<span class="">欢迎回来，<%=userInfo[0]['user_id']%>！</span>
                <a class="btn btn-link" href="/logout">退出</a>
				<%}%>
			</p>
		</div>
		<table class="table table-bordered">
			<thead>
				<tr>
					<th>id</th>
					<th>user</th>
					<th>name</th>
					<th>pwd</th>
					<th>register_date</th>
					<th>last_login_date</th>
				</tr>
			</thead>
			<tbody>
				<%for(var i=0;i<sqlResult.length;i++){%>
				<tr>
					<td><%=sqlResult[i].id%></td>
					<td><%=sqlResult[i]['user_id']%></td>
					<td><%=sqlResult[i]['name']%></td>
					<td><%=sqlResult[i]['pwd']%></td>
					<td><%=sqlResult[i]['register_date']%></td>
					<td><%=sqlResult[i]['last_login_date']%></td>
				</tr>
				<%}%>
			</tbody>
		</table>
	</div>
</div>

<%include footer.ejs%>
